﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoMapper;

namespace JHT.SimpleTaskSystem.Dto
{
    public class SimpleTaskDtoMapping : IDtoMapping
    {
        public void CreateMapping(IMapperConfigurationExpression mapperConfig)
        {
            mapperConfig.CreateMap<Person, PersonDto>();
            mapperConfig.CreateMap<CreateTaskInput, SimpleTask>();
            mapperConfig.CreateMap<SimpleTask, UpdateTaskInput>();
            mapperConfig.CreateMap<SimpleTask, TaskDto>()
                  .ForMember(p => p.AssignedPersonName, opt => opt.MapFrom(m => m.AssignedPerson.UserName));
        }
    }
}
